package com.example.mapper;

import com.example.pojo.OrderDetails;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface OrderDetailsMapper {
    @Update("UPDATE orddetail set DelCode=#{DelCode},ordCode=#{DelCode},goodCode=#{goodCode},price=#{price},total=#{total} where DelCode=#{DelCode}")
    void changeOrderDetails(OrderDetails orderDetails);

    void addOrderDetails(List<OrderDetails> orderDetails);

    @Delete("delete from orddetail where DelCode=#{id}")
    void deleteOrderDetails(String id);

    @Select("select ordCode,goodName,price,num,total from orddetail,good where ordCode=#{id} and orddetail.goodCode=good.goodCode")
    List<OrderDetails> getDetails(Integer id);
}
